package com.data.controller;

import com.data.pojo.StockCode;
import com.data.service.StockCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author Str
 * @Date 2022/2/15 23:09
 * @Description :
 */
@RestController
@RequestMapping("/stockCode")
public class StockCodeController {
    @Autowired
    private StockCodeService stockCodeService;

    // http://localhost:8000/stockCode/putStockCode?code=1000002
    // http://localhost:8000/stockCode/putStockCode?code=0600000
//    @RequestMapping("/putStockCode")
//    public List<StockCode> putStockCode(String code){
//        return stockCodeService.putStockCode();
//    }

    // http://localhost:8000/stockCode/getStockCode
    @RequestMapping("/getStockCode")
    @CrossOrigin  // 解决跨域问题
    public Map<String, StockCode> getStockCode() {
        return stockCodeService.getStockCode();
    }

}
